<template>
    <!-- 我的发布 -->
    <view class="container" v-if="articleList">
        <view class="title">发布数({{ articleList.length }})</view>
        <PostCard v-for="(item, index) in articleList" :key="index" :item="item" :tool="true" @delete="getArticleList">
        </PostCard>
    </view>
</template>
<script setup lang="ts">
import PostCard from '@/components/PostCard.vue';
import { API_getMyArticleList } from '@/service/article';
import { useUserStore } from '@/store';
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
import type { ArticleItem } from '@/type/article';
const userStore = useUserStore();
const articleList = ref<ArticleItem[]>([]);
const getArticleList = async () => {
    let res = await API_getMyArticleList(userStore.userInfo!.id!);
    articleList.value = res.data;
}
onLoad(() => {
    getArticleList();
})
</script>
<style scoped lang="scss">
.container {

    padding: 20rpx;

    .title {
        font-size: 30rpx;
        color: #333;
    }
}
</style>
